package rules.bookinfo;

import rules.Rule;
import books.BookInfo;
import exceptions.BadFormedBookInfoException;

/**
 */
public class BookInfoNotNullFieldsRule implements Rule<BookInfo> {

    @Override
    public void validate(final BookInfo info) {
        if (info.getAuthors() == null || info.getCategories() == null || info.getDescription() == null
                || info.getIsbn() == null || info.getPublisher() == null || info.getRegistrationDate() == null
                || info.getTitle() == null) {
            throw new BadFormedBookInfoException();
        }
    }

}
